home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / music / eked-m1.zoo / src / defs.h < prev    next >
Text File  |  1995-02-19  |  3KB  |  136 lines

  1. /*
  2.  *  EKED-M1 : Editor for Korg M1 synth; defs.h : global defines
  3.  *  Copyright (C) 1995 Steven M. Eker (Steven.Eker@brunel.ac.uk)
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with this program; if not, write to the Free Software
  17.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #define FILE_SPEC_SIZE        200
  21.  
  22. /*
  23.  *    Korg M1 specific numbers
  24.  */
  25. #define KORG_ID            0x42
  26. #define FORMAT_ID        0x30
  27. #define M1_ID            0x19
  28.  
  29. /*
  30.  *    Sizes
  31.  */
  32. #define GLOBAL_SIZE        861
  33. #define COMBINATION_SIZE    124
  34. #define PROGRAM_SIZE        143
  35. #define PROGRAM_OFFSET        (GLOBAL_SIZE + 100 * COMBINATION_SIZE)
  36.  
  37. #define    AD_SIZE            (31496+3)
  38. #define GD_SIZE            984
  39. #define CD_SIZE            14172
  40. #define PD_SIZE            16343
  41. #define    AD50_SIZE        (16240+2)
  42. #define CD50_SIZE        7086
  43. #define PD50_SIZE        8172
  44.  
  45. /*
  46.  *    Size based functions
  47.  */
  48. #define COMB_DATA(b, n)    \
  49.     ((b)->data + GLOBAL_SIZE + (n) * COMBINATION_SIZE)
  50. #define PROG_DATA(b, n)    \
  51.     ((b)->data + PROGRAM_OFFSET + (n) * PROGRAM_SIZE)
  52.  
  53. /*
  54.  *    Modes
  55.  */
  56. #define COMB_MODE    0
  57. #define EDIT_COMB_MODE    1
  58. #define PROG_MODE    2
  59. #define EDIT_PROG_MODE    3
  60. #define GLOBAL_MODE    4
  61. #define SEQ_MODE    6
  62.  
  63. /*
  64.  *    Sysex function codes
  65.  */
  66. #define PROG_DUMP        0x40
  67. #define COMB_DUMP        0x49
  68. #define GLOBAL_DATA_DUMP    0x51
  69. #define ALL_PROG_DUMP        0x4C
  70. #define ALL_COMB_DUMP        0x4D
  71. #define ALL_DATA_DUMP        0x50
  72.  
  73. #define PARAMETER_CHANGE    0x41
  74. #define MODE_CHANGE        0x4E
  75.  
  76. #define DATA_LOAD_OK        0x23
  77. #define DATA_LOAD_ERR        0x24
  78.  
  79. #define GLOBAL_DATA_REQ        0x0E
  80. #define MODE_REQ        0x12
  81. #define ALL_PROG_REQ        0x1C
  82. #define ALL_COMB_REQ        0x1D
  83.  
  84. /*
  85.  *    TX/RX flags
  86.  */
  87. #define TX_GLOB        1
  88. #define TX_COMB        2
  89. #define TX_PROG        4
  90. #define TX_CARD        8
  91. #define TX_ONE        16
  92.  
  93. /*
  94.  *    M1 control stuff
  95.  */
  96. #define EXITING        1
  97. #define FORCE_MODE    2
  98. #define FORCE_NR    4
  99. #define FORCE_DATA    8
  100.  
  101. /*
  102.  *    User window messages
  103.  */
  104. #define M1_CTRL_LOST    0
  105. #define UPDATE_ITEM    1
  106.  
  107. /*
  108.  *    Default return values
  109.  */
  110. #define SUCCESS        0
  111. #define FAILURE        (-1)
  112.  
  113. /*
  114.  *    Macros
  115.  */
  116. #define EXTRACT_BIT(v, i)    (((v) & (1 << (i))) != 0)
  117. #define REPLACE_BIT(v, i, j)    ((v) ^ (((v) ^ ((j) << (i))) & (1 << (i))))
  118. #define EXTRACT_2LO(v)        ((v) & 3)
  119. #define REPLACE_2LO(v, i)    (((v) & ~3) | (i))
  120. #define EXTRACT_56(v)        (((v) >> 5) & 3)
  121. #define EXTRACT_NYBLE(v)    ((v) & 0xF)
  122. #define REPLACE_NYBLE(v, i)    (((v) & ~0xF) | i)
  123. #define INSIDE(x, y, box)    ((x) >= (box).v_x1 && (x) <= (box).v_x2 && \
  124.                  (y) >= (box).v_y1 && (y) <= (box).v_y2 )
  125.  
  126. #define OBJECT_TO_GRECT(ob)    ((GRECT *) &((ob)->ob_x))
  127. #define MESSAGE_TO_GRECT(m)    ((GRECT *) &((m)[4]))
  128. #define TEXT_PTR(form, ob)    (((TEDINFO *) (form)[ob].ob_spec)->te_ptext)
  129. #define STRING_PTR(form, ob)    ((char *) (form)[ob].ob_spec)
  130.  
  131. #define LBAL        (-1)
  132. #define RBAL        (-2)
  133. #define SBAL        (-3)
  134.  
  135. #define NIL        (-1)
  136.